import React, { Component } from 'react'

export default class UseEffectClass extends Component {
  constructor() {
    super()
    this.state = {
      count: 0
    }
  }
  addCount() {
    this.setState({
      count: this.state.count + 1
    }, ()=> {
      document.title = `点击次数:${this.state.count}`
    })
  }
  componentDidMount() {
    document.title = `点击次数:${this.state.count}`
  }
  render() {
    return (
      <div>
        <p>count: {this.state.count}</p>
        <button onClick={()=>this.addCount()}>+1</button>
      </div>
    )
  }
}
